<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * HITI AdminCP
 *
 * @package     HITI AdminCP Project
 * @since       Monday, October 21, 2013, 6:00 PM
 * @final       
 * @category    Models
 * @see 		Hosting status
 * @author      PHUOCNGUYEN - HITI Dev Team
 * @copyright   Copyright (c) 2013, HITI Corp
 */

class Hosting_status_model extends CI_Model {
	public function __construct()
	{
		parent::__construct();
	}

	public function show()
	{
		$db_name = $this->db->database;
		$query = $this->db->query(sprintf('SHOW TABLE STATUS FROM %s', $db_name));
		return $query->result_array();
	}

	public function util_table($op, $table_name)
	{
		$query = $this->db->query(sprintf('%s table %s', $op, $table_name));
		return $query->row_array();
	}

	public function dbsize()
	{
		$this->db->select('SUM(data_length + index_length) AS DB_SIZE');
		$this->db->from('information_schema.TABLES');
		$this->db->where('TABLE_SCHEMA', $this->db->database);
		$query = $this->db->get();
		$info = $query->row_array();
		return $info['DB_SIZE'];
	}
}

/* End of file hosting_status_model.php */
/* Location: ./application/models/hosting_status_model.php */